package com.gzhryc.pay.adaptation.weixin.enums;

import com.gzhryc.common.config.I18nTools;
import com.gzhryc.pay.enums.BankType;

public enum EWXPayBankCode {

	ICBC(BankType.ICBC.index(),"1002"),
	ABOC(BankType.ABOC.index(),"1005"),
	CCB(BankType.CCB.index(),"1003"),
	BOC(BankType.BOC.index(),"1026"),
	BCM(BankType.BCM.index(),"1020"),
	CMB(BankType.CMB.index(),"1001"),
	PSBC(BankType.PSBC.index(),"1066"),
	CMBC(BankType.CMBC.index(),"1006"),
//	SHRCB(BankType.SHRCB.index(),"1010"),
	CITIC(BankType.CITIC.index(),"1021"),
//	SPDB(BankType.SPDB.index(),"1004"),
	CIB(BankType.CIB.index(),"1009"),
	CEB(BankType.CEB.index(),"1022"),
	GDB(BankType.GDB.index(),"1027"),
	HXB(BankType.HXB.index(),"1025"),
//	NBBANK(BankType.NBBANK.index(),"1056"),
	BOB(BankType.BOB.index(),"4836");
//	BOSC(BankType.BOSC.index(),"1024");

	private Integer index;
	private String note;

	EWXPayBankCode(Integer index, String note){
		this.index = index;
		this.note = note;
	}

	public Integer index() {
		return index;
	}

	public String note() {
		I18nTools.I18n i18n = I18nTools.getCurrentI18n();
		if(i18n != null) {
			return i18n.get(this.name(),note);
		}
		return note;
	}

	public static EWXPayBankCode get(Integer index) {
		EWXPayBankCode[] temp = EWXPayBankCode.values();
		for(int i=0;i<temp.length;i++){
			EWXPayBankCode item = temp[i];
			if(item.index.equals(index)){
				return item;
			}
		}
		return null;
	}

	public static String note(Integer index){
		EWXPayBankCode[] temp = EWXPayBankCode.values();
		for(int i=0;i<temp.length;i++){
			EWXPayBankCode item = temp[i];
			if(item.index.equals(index)){
				return item.note();
			}
		}
		return null;
	}
}
